package com.gljx.web.service.impl;

import com.gljx.web.Entity.Outwarehousechild;
import com.gljx.web.Entity.Outwarehousetable;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.OutwarehousechildMapper;
import com.gljx.web.dao.OutwarehousetableMapper;
import com.gljx.web.service.OutwarehousetableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 出库登记业务逻辑接口实现类
 *
 * @Author: WuLianFa
 * @CreationTime: 2018/6/1 0001 14:30
 */
@Service
public class OutwarehousetableServiceImpl extends CommonDao implements OutwarehousetableService {
    @Autowired
    private OutwarehousetableMapper outwarehousetableMapper;
    @Autowired
    private OutwarehousechildMapper outwarehousechildMapper;

    /**
     * 查询全部出库父表信息
     * Created by WuLianFa on 2018/6/1 0001 16:41
     */
    public List<Outwarehousetable> queryAllOutwarehouseRecord(String ckSchoolid, String startTime, String endTime) {
        return outwarehousetableMapper.queryAllOutwarehouseRecord(ckSchoolid, startTime, endTime);
    }

    /**
     * 父表新增出库记录
     * Created by WuLianFa on 2018/6/8 0008 15:16
     */
    public void insertOutwarehouseRecordParent(Outwarehousetable outwarehousetable) {
        outwarehousetableMapper.insertSelective(outwarehousetable);
    }

    /**
     * 根据出库编号查询出库父表信息
     * Created by WuLianFa on 2018/6/6 0006 09:59
     */
    public Outwarehousetable selectByckId(String ckId) {
        return outwarehousetableMapper.selectByPrimaryKey(ckId);
    }

    /**
     * 修改父表信息
     * Created by WuLianFa on 2018/6/11 0011 15:40
     */
    public void updateOutwarehouseRecordParent(Outwarehousetable outwarehousetable) {
        outwarehousetableMapper.updateByPrimaryKeySelective(outwarehousetable);
    }

    /**
     * 删除父类出库记录
     * Created by WuLianFa on 2018/6/6 0006 09:50
     */
    public void deleteOutwarehouseMassageParent(String ckId) {
        outwarehousetableMapper.deleteByPrimaryKey(ckId);
    }

    /**
     * 查询全部出库物品子表信息
     * Created by WuLianFa on 2018/6/1 0001 16:42
     */
    public List<Outwarehousechild> queryAllOutwarehouseChildRecord(String ckOutwarehouseid, String ckOutwarehousegoodsname, String ckOutwarehousegoodstype, String ckOutwarehouseggid) {
        return outwarehousechildMapper.queryAllOutwarehouseChildRecord(ckOutwarehouseid, ckOutwarehousegoodsname, ckOutwarehousegoodstype, ckOutwarehouseggid);
    }

    /**
     * 子表新增出库记录
     * Created by WuLianFa on 2018/6/8 0008 15:16
     */
    public void insertOutwarehouseRecordChild(Outwarehousechild outwarehousechild) {
        outwarehousechildMapper.insertSelective(outwarehousechild);
    }

    /**
     * 修改子表信息
     * Created by WuLianFa on 2018/6/11 0011 15:40
     */
    public void updateOutwarehouseRecordChild(Outwarehousechild outwarehousechild) {
        outwarehousechildMapper.updateByPrimaryKeySelective(outwarehousechild);
    }

    /**
     * 删除子类出库记录
     * Created by WuLianFa on 2018/6/6 0006 09:50
     */
    public void deleteOutwarehouseMassageChild(String ckId) {
        outwarehousechildMapper.deleteByckId(ckId);
    }

}
